package IC.asm.operands;

import IC.asm.Visitor;

public class IntImmediate extends ImmOperand {

	private final int val;

	/**
	 * Create an immediate operand from integer value 
	 * @param val the immediate value
	 */
	public IntImmediate(int val) {
		this.val = val;
	}

	/**
	 * @return operand value
	 */
	public int getVal() {
		return val;
	}
	
	@Override
	public <D, U> U accept(Visitor<D, U> v, D d) {
		return v.visit(this, d);
	}
	
	@Override
	public boolean equals(Object o)
	{
		if (! (o instanceof IntImmediate) )
			return false;
		return val == ((IntImmediate)o).val ;
	}
}
